package delayMessage.queue;

import java.util.concurrent.DelayQueue;

/**
 * 任务体的消费者
 *
 * Created by Zhou_Bing on 2018/9/29.
 */
public class JobConsumer implements Runnable{

    private DelayQueue<Job> queue;

    JobConsumer(DelayQueue<Job> queue){
        this.queue = queue;
    }

    @Override
    public void run() {
        while(true){
            try {
                Job job = queue.take();
                //job.execute();
                job.callBack();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
